package group6renderer.renderernode;

import group6renderer.Display;
import group6renderer.Visitor;

public class TitleNode extends TreeNode {
	
    private String htmlTitle;
	
    public TitleNode()
    {
    	name="title";
    	htmlTitle=new String("html title");
    }
    
    public void drawNode(Display disp)
    {
    	disp.setTitle(getTitle());
    }
	
	public  boolean isLeaf()
    {
    	return false;
    }
    public boolean hasClosing()
    {
    	return true;
    }

    public TreeNode copy()
    {
    	return new TitleNode();
    }
    @Override
	public void accept(Visitor theVisitor) {
		theVisitor.visit(this);
	}
    
    
    public void setTitle(String htmlTitle)
    {
    	this.htmlTitle=htmlTitle;
    	System.out.println(htmlTitle);
    }
   
    public String getTitle()
    {
    	if (this.getChildrenNum()>0)
    	{
    		TextNode t=(TextNode)getChild(0);
    		htmlTitle=t.getText();
    		removeChild(0);
    		
    	}
    	
    	return htmlTitle;
    }

}